//
//  GLMessageViewController.swift
//  GLWeiBo
//
//  Created by mac on 16/5/9.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit
private let GLMessageID = "GLMessageID"
class GLMessageViewController: GLRootViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        //prepareRefreshControl()
        tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: GLMessageID)
        visitorView?.setupInfo("嘻嘻秀‘’‘’‘’‘", imageName: "visitordiscover_image_message")
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        if view.window == nil {
            dataCount = 0
            tableView.reloadData()
        }
        // Dispose of any resources that can be recreated.
    }
    var dataCount: Int = 0
    override func loadData() {
        dispatch_after(
            dispatch_time(DISPATCH_TIME_NOW, Int64(1.0 * Double(NSEC_PER_SEC))),
                dispatch_get_main_queue(), { () -> Void in
           self.dataCount += 10
            self.refresh.endRefreshing()
            self.tableView.reloadData()
        })
    }
}
extension GLMessageViewController {
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return dataCount
    }
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(GLMessageID, forIndexPath: indexPath)
        cell.textLabel?.text = "\(indexPath.row)"
        return cell
    }
    
}